﻿//Copyright (c) Chris Pietschmann 2013 (http://pietschsoft.com)
//Licensed under the GNU Library General Public License (LGPL)
//License can be found here: http://easypatterns.codeplex.com/license

using EasyPatterns.Factory;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace EasyPatterns.Test.Factory
{
    [TestClass]
    public class SimpleFactoryTest
    {
        [TestMethod]
        public void Constructor_001()
        {
            var target = new SimpleFactory<DataAccessLayer>();

            Assert.IsInstanceOfType(target, typeof(IFactory<DataAccessLayer>));
        }

        [TestMethod]
        public void Constructor_002()
        {
            var target = new SimpleFactory<DataAccessLayer>();

            Assert.IsInstanceOfType(target, typeof(IFactory));
        }

        [TestMethod]
        public void Constructor_003()
        {
            var target = new SimpleFactory<DataAccessLayer>();

            Assert.IsInstanceOfType(target, typeof(Factory<DataAccessLayer, DataAccessLayer>));
        }

        [TestMethod]
        public void Create_001()
        {
            var target = new SimpleFactory<DataAccessLayer>();

            var actual = target.Create();

            Assert.IsNotNull(actual);
            Assert.IsInstanceOfType(actual, typeof(DataAccessLayer));
        }

        [TestMethod]
        public void Create_002()
        {
            IFactory target = new SimpleFactory<DataAccessLayer>();

            var actual = target.Create();

            Assert.IsNotNull(actual);
            Assert.IsInstanceOfType(actual, typeof(DataAccessLayer));
        }
    }
}
